package com.edu.app.util.wechat;


import com.edu.app.exception.wechat.NotSupportStoreImpl;
import com.edu.app.util.wechat.impl.WxInMemoryStorage;

public class WxTokenStoreUtil {
    static WxTokenStorage wxTokenStorage = null;
    public static  WxTokenStorage GetWxStore(String storeName) throws NotSupportStoreImpl {
        if(wxTokenStorage == null){
            synchronized (WxTokenStoreUtil.class){
                if(wxTokenStorage == null) {
                    if (storeName.equalsIgnoreCase("memorystore"))
                        wxTokenStorage = new WxInMemoryStorage();
                    else if(storeName.equalsIgnoreCase("redisstore")){
                        throw new NotSupportStoreImpl("Not support store implementation: " + storeName);
                    }
                }
            }
        }
        return wxTokenStorage;
    }

}
